#include "Logic.h"
Logic::Logic(void)
	:Component(COMP_LOGIC),
	m_luaScript()
{
}

Logic::~Logic()
{
}

void Logic::AddedToObject()
{
	RequestMessage(MSG_INITIAL,&Logic::Initial);
	RequestMessage(MSG_INITIAL_GAME_DATA,&Logic::InitialGameData);
}


//In this function, only initialize the component relativation of logic
//The game data are initialized in PrepareGame function
void Logic::Initial(const Message& msg)
{
	m_luaScript=boost::make_shared<LuaScript>("default.lua");
	AddLocalComponent(m_luaScript);
	SendMessage(MSG_INITIAL_LOGIC);
}

void Logic::InitialGameData(const Message& msg)
{
	SendMessage(MSG_RUN_SCRIPT,AuxGroupArgus(string("Initial")));
}

bool Logic::Frame()
{
	return true;
}